package pacman.entries.pacman;

import java.util.ArrayList;

import pacman.entries.pacman.ml.behaviors.*;
import pacman.entries.pacman.ml.features.*;
import pacman.game.Constants.GHOST;

public class GeneticPacMan3 extends LearningPacMan {
	
	@Override
	protected LearningPacMan NewInstance() {
		return new GeneticPacMan3();
	}
	
	@Override
	protected void InitTestWeights() {
		
		features = new ArrayList<FeatureExtractor>(2);
		features.add(FeatureExtractor.getInstance(NonEdibleGhostDistanceThresholdFeature.class, 20));
		//features.add(FeatureExtractor.getInstance(EdibleGhostsFeature.class, 0));
		features.add(FeatureExtractor.getInstance(DistanceToGhostFeature.class, 0.0f));
		features.add(FeatureExtractor.getInstance(DistanceToGhostFeature.class, 1.0f));
		features.add(FeatureExtractor.getInstance(DistanceToGhostFeature.class, 2.0f));
		features.add(FeatureExtractor.getInstance(DistanceToGhostFeature.class, 3.0f));
		features.add(FeatureExtractor.getInstance(GhostIsEdibleFeature.class, 0.0f));
		features.add(FeatureExtractor.getInstance(GhostIsEdibleFeature.class, 1.0f));
		features.add(FeatureExtractor.getInstance(GhostIsEdibleFeature.class, 2.0f));
		features.add(FeatureExtractor.getInstance(GhostIsEdibleFeature.class, 3.0f));
		features.add(FeatureExtractor.getInstance(PowerPillDistance.class, 0.0f));
		features.add(FeatureExtractor.getInstance(NearestPillDistance.class, 0.0f));
		features.add(FeatureExtractor.getInstance(DistanceToClosestGhostFeature.class, 0.0f));
		features.add(FeatureExtractor.getInstance(GhostDirectionFeature.class, 0.0f));
		features.add(FeatureExtractor.getInstance(GhostDirectionFeature.class, 1.0f));
		features.add(FeatureExtractor.getInstance(GhostDirectionFeature.class, 2.0f));
		features.add(FeatureExtractor.getInstance(GhostDirectionFeature.class, 3.0f));
		features.add(FeatureExtractor.getInstance(GhostMovementFeature.class, 0.0f));
		features.add(FeatureExtractor.getInstance(GhostMovementFeature.class, 1.0f));
		features.add(FeatureExtractor.getInstance(GhostMovementFeature.class, 2.0f));
		features.add(FeatureExtractor.getInstance(GhostMovementFeature.class, 3.0f));
		
		// features.add(new NonEdibleGhostDistanceThresholdFeature(20));
		// features.add(new EdibleGhostsFeature());
		
		behaviors = new ArrayList<Behavior>();
		behaviors.add(new RunAwayFromGhostsBehavior());
		behaviors.add(new EatClosestEdibleGhostBehavior());
		behaviors.add(new EatSingleEdibleGhostBehavior(GHOST.INKY));
		behaviors.add(new EatSingleEdibleGhostBehavior(GHOST.PINKY));
		behaviors.add(new EatSingleEdibleGhostBehavior(GHOST.BLINKY));
		behaviors.add(new EatSingleEdibleGhostBehavior(GHOST.SUE));
		behaviors.add(new RunAwayFromSingleGhostBehavior(GHOST.INKY));
		behaviors.add(new RunAwayFromSingleGhostBehavior(GHOST.BLINKY));
		behaviors.add(new RunAwayFromSingleGhostBehavior(GHOST.PINKY));
		behaviors.add(new RunAwayFromSingleGhostBehavior(GHOST.SUE));
		behaviors.add(new EatClosestPowerPill());
		behaviors.add(new EatClosestPillBehavior());
		defaultBehavior = new EatClosestPillBehavior();
		
		N = features.size();
		M = behaviors.size();
		m_Weights = new float[N][M];
		m_FeatureValues = new float[N];
		
		
		for (int i = 0; i < N; i++)
			for (int j = 0; j < M; j++)
				m_Weights[i][j] = 1.0f;
		
	}
	
}
